//
//  ProductModel.m
//  __PRODUCTNAME__
//
//  Created by 黄威 on 16/09/09
//  Copyright (c) __ORGANIZATIONNAME__. All rights reserved.
//

#import "ProductModel.h"
#import "ProductComments.h"


@implementation ProductModel

-(void)setValue:(id)value forKey:(NSString *)key{
    
    [super setValue:value forKey:key];
    
    if ([key isEqualToString:@"id"]) {
        
        _uid = value;
        
    }
    
   if ([key isEqualToString:@"comments"]) {
        
        
        NSMutableArray *array = [NSMutableArray array];
        
        for (NSDictionary *dic in value) {
            
            ProductComments *comment = [ProductComments modelWithDic:dic];
            
            [array addObject:comment];
            
        }
        _comments = array;
        
    }
    
    
}

@end
